﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WsdShop.Model.Enum;

namespace WsdShop.Model.ViewModels
{
    public class SpikeResponse : Activity_Spike
    {
        /// <summary>
        /// 已秒杀库存
        /// </summary>
        public int TotalSpikeStock { get; set; }

        /// <summary>
        /// 总库存
        /// </summary>
        public int TotalStock { get; set; }

        public string ActivityState
        {
            get
            {
                if (BeginTime > DateTime.Now)
                {
                    return EnumActivityState.未开始.ToString();
                }
                if (BeginTime <= DateTime.Now && EndTime >= DateTime.Now)
                {
                    return EnumActivityState.进行中.ToString();
                }
                else
                {
                    return EnumActivityState.已结束.ToString();
                }
            }
        }
    }


    public class SpikeEditResponse
    {
        public SpikeResponse Activity { get; set; }

        public List<SpikeSpecResponse> SpikeActivityInfoList { get; set; }
    }


    public class SpikeSpecResponse : Activity_SpikeSpec
    {
        public string ImgUrl { get; set; }

        public string Name { get; set; }

        public decimal MarketPrice { get; set; }

        public decimal SalePrice { get; set; }

        public int CanSaleStock { get; set; }
    }

    public class SpikeProductResponse : Activity_SpikeSpec
    {
        public string ProductImgUrl { get; set; }

        public string ProductName { get; set; }

        public decimal MarketPrice { get; set; }
    }

    public class SpikeListResponse : Activity_Spike
    {
        public string ActivityState
        {
            get
            {
                if (BeginTime > DateTime.Now)
                {
                    return EnumActivityState.未开始.ToString();
                }
                if (BeginTime <= DateTime.Now && EndTime >= DateTime.Now)
                {
                    return EnumActivityState.进行中.ToString();
                }
                else
                {
                    return EnumActivityState.已结束.ToString();
                }
            }
        }

        public string SpikeTime
        {
            get
            {
                return BeginTime.ToString("HH:mm");
            }
        }

        public string SpikeBeginTime
        {
            get
            {
                return BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }

        public string SpikeEndTime
        {
            get
            {
                return EndTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }

        public List<SpikeProductResponse> SpikeProductList { get; set; }

    }

}
